// 青蛙跳台阶
function jumpWays(n) {
    if (n === 1) return 1;
    if (n === 2) return 2;
    let prev = 1, cur = 2;
    for(let i = 3; i<= n; i++) {
        let next = prev + cur;
        prev = cur;
        cur = next;
    }
    return cur;
}
console.log(jumpWays(5)); // 输出 8